Skip to content

Use cppcheck right#654

Merged
AlexInLog merged 9 commits into
v2from
use_cppcheck_right
Oct 8, 2024
Merged

Use cppcheck right#654
AlexInLog merged 9 commits into
v2from
use_cppcheck_right

Conversation

@AlexInLog

@AlexInLog AlexInLog commented Oct 7, 2024

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Introduced new suppression rules in static analysis for improved warning management.
  • Bug Fixes

    • Updated method signature in the observer class to return a new instance, enhancing functionality.
  • Chores

    • Modified configuration for cppcheck to streamline suppression handling.
    • Updated clang-tidy configuration to enforce C++20 standard during analysis.

@coderabbitai

coderabbitai Bot commented Oct 7, 2024

Copy link
Copy Markdown
Contributor
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request involve updates to three files: CMakePresets.json, cppcheck.supp, and observer.hpp. The CMakePresets.json file modifies the cppcheck preset to utilize a suppression list file instead of a specific suppression command. The cppcheck.supp file introduces seven new suppression rules for better control over warnings. Lastly, the observer.hpp file changes the return type of the as_dynamic method in the observer class from a reference to a new instance, affecting its usage.

Changes

File Change Summary
CMakePresets.json Updated CMAKE_CXX_CPPCHECK in cppcheck preset to use a suppression list file. Updated CMAKE_CXX_CLANG_TIDY in clang-tidy preset to include -extra-arg=-std=c++20.
cppcheck.supp Added suppression rules: missingIncludeSystem, noExplicitConstructor, unknownMacro, shadowFunction, unusedVariable, localMutex, and unmatchedSuppression.
src/rpp/rpp/observers/observer.hpp Changed return type of as_dynamic method from const dynamic_observer<Type>& to dynamic_observer<Type>.

Possibly related PRs

  • Change sonarcloud analysis method #652: The changes in this PR involve updates to analysis configurations that may relate to the overall build and analysis process, similar to the modifications made in CMakePresets.json regarding static analysis tools like cppcheck and clang-tidy.

Poem

In the garden of code, changes bloom bright,
Suppressions now tidy, warnings take flight.
Observers return with a new, gentle grace,
A hop and a skip in this digital space.
With each little tweak, our project takes form,
A rabbit's delight in the code's lively swarm! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1ec1d93 and aa955b8.

📒 Files selected for processing (2)
  • CMakePresets.json (1 hunks)
  • cppcheck.supp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CMakePresets.json
🧰 Additional context used

Comment thread cppcheck.supp
Comment on lines +1 to +11
missingIncludeSystem

noExplicitConstructor

unknownMacro

shadowFunction

unusedVariable

localMutex

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider the implications of using these suppression rules and document their rationale.

The addition of these suppression rules for Cppcheck is noted. While suppression rules can be useful for managing false positives or known issues, they should be used judiciously to avoid hiding potential problems. Here are some considerations:

  1. missingIncludeSystem: Generally safe, but ensure all necessary system headers are available on the target system.
  2. noExplicitConstructor: Be cautious as this might hide issues with implicit conversions.
  3. unknownMacro: Ensure all macros are properly defined to avoid suppressing genuine issues.
  4. shadowFunction: Use carefully as function shadowing can lead to confusion and bugs.
  5. unusedVariable: Monitor to prevent code clutter.
  6. localMutex: Be aware that this might hide potential threading issues.

Consider the following recommendations:

  1. Document the specific reasons for each suppression rule, explaining why it's necessary and any associated risks.
  2. Implement a process for periodic review of these suppressions to ensure they remain relevant and necessary.
  3. If possible, address the underlying issues that necessitate these suppressions in the long term.

Example documentation format:

# Cppcheck Suppression Rules

1. missingIncludeSystem
   Reason: [Explain why this suppression is necessary]
   Risk: [Describe any potential risks associated with this suppression]
   Review Date: [Date for next review]

[Repeat for each rule]

This documentation will help maintain transparency about the suppressed warnings and facilitate future code maintenance.

@github-actions

github-actions Bot commented Oct 7, 2024

Copy link
Copy Markdown
Contributor

BENCHMARK RESULTS (AUTOGENERATED)

ci-ubuntu-gcc

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 303.24 ns 2.19 ns 2.18 ns 1.01
Subscribe empty callbacks to empty observable via pipe operator 306.75 ns 2.18 ns 2.17 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 741.77 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 1046.94 ns 3.73 ns 3.73 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2278.62 ns 151.08 ns 152.22 ns 0.99
defer from array of 1 - defer + create + subscribe + immediate 752.91 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2106.30 ns 59.58 ns 59.60 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3026.22 ns 32.68 ns 32.67 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 29641.56 ns 29945.21 ns 29501.67 ns 1.02
from array of 1000 - create + as_blocking + subscribe + new_thread 41849.04 ns 52768.68 ns 52962.70 ns 1.00
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3588.46 ns 214.20 ns 216.91 ns 0.99

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1106.96 ns 0.31 ns 0.31 ns 1.00
immediate_just+filter(true)+subscribe 911.02 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1024.62 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 901.65 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+first()+subscribe 1240.22 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 922.74 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1120.08 ns 18.04 ns 18.02 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 952.04 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 267.70 ns 2.17 ns 2.18 ns 1.00
current_thread scheduler create worker + schedule 366.52 ns 5.60 ns 5.59 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 820.14 ns 56.14 ns 55.95 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 863.95 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 934.04 ns 0.31 ns 0.31 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2351.74 ns 209.53 ns 206.20 ns 1.02
immediate_just+buffer(2)+subscribe 1536.04 ns 13.68 ns 13.68 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2392.31 ns 1341.89 ns 1318.11 ns 1.02

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 858.81 ns - - 0.00
immediate_just+take_while(true)+subscribe 846.82 ns 0.31 ns 0.31 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 1996.93 ns 0.31 ns 0.31 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 3400.89 ns 255.40 ns 261.18 ns 0.98
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3681.33 ns 206.80 ns 210.79 ns 0.98
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 179.83 ns 181.60 ns 0.99
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3588.83 ns 1319.02 ns 1321.84 ns 1.00
immediate_just(1) + zip(immediate_just(2)) + subscribe 2147.84 ns 200.71 ns 205.81 ns 0.98

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 34.76 ns 14.82 ns 30.56 ns 0.48
subscribe 100 observers to publish_subject 199947.17 ns 16340.09 ns 16197.58 ns 1.01
100 on_next to 100 observers to publish_subject 28139.47 ns 17219.81 ns 17227.10 ns 1.00

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1415.51 ns 13.98 ns 13.98 ns 1.00
basic sample with immediate scheduler 1419.68 ns 5.59 ns 5.59 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 956.14 ns 0.31 ns 0.31 ns 1.00

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2079.02 ns 920.61 ns 930.84 ns 0.99
create(on_error())+retry(1)+subscribe 597.67 ns 129.95 ns 122.39 ns 1.06

ci-macos

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 977.80 ns 4.00 ns 3.91 ns 1.02
Subscribe empty callbacks to empty observable via pipe operator 983.19 ns 3.95 ns 3.91 ns 1.01

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1928.77 ns 0.23 ns 0.23 ns 1.00
from array of 1 - create + subscribe + current_thread 2438.05 ns 33.00 ns 33.21 ns 0.99
concat_as_source of just(1 immediate) create + subscribe 5460.17 ns 423.96 ns 424.65 ns 1.00
defer from array of 1 - defer + create + subscribe + immediate 1968.88 ns 0.23 ns 0.23 ns 1.00
interval - interval + take(3) + subscribe + immediate 4917.03 ns 113.69 ns 120.85 ns 0.94
interval - interval + take(3) + subscribe + current_thread 6010.74 ns 94.71 ns 96.65 ns 0.98
from array of 1 - create + as_blocking + subscribe + new_thread 83363.46 ns 80740.00 ns 79170.00 ns 1.02
from array of 1000 - create + as_blocking + subscribe + new_thread 90401.92 ns 86702.31 ns 86980.46 ns 1.00
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 8241.38 ns 599.90 ns 590.09 ns 1.02

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 2854.99 ns 0.23 ns 0.23 ns 1.02
immediate_just+filter(true)+subscribe 2096.45 ns 0.23 ns 0.23 ns 1.03
immediate_just(1,2)+skip(1)+subscribe 2792.50 ns 0.23 ns 0.23 ns 1.03
immediate_just(1,1,2)+distinct_until_changed()+subscribe 2075.93 ns 0.47 ns 0.46 ns 1.03
immediate_just(1,2)+first()+subscribe 3176.49 ns 0.23 ns 0.23 ns 1.02
immediate_just(1,2)+last()+subscribe 2368.14 ns 0.23 ns 0.23 ns 1.03
immediate_just+take_last(1)+subscribe 3019.11 ns 0.23 ns 0.23 ns 1.02
immediate_just(1,2,3)+element_at(1)+subscribe 2110.40 ns 0.23 ns 0.23 ns 1.02

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 857.01 ns 4.17 ns 4.11 ns 1.01
current_thread scheduler create worker + schedule 1200.79 ns 39.06 ns 39.05 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 1999.12 ns 203.84 ns 203.62 ns 1.00

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 2092.15 ns 4.20 ns 4.33 ns 0.97
immediate_just+scan(10, std::plus)+subscribe 2327.38 ns 0.47 ns 0.46 ns 1.03
immediate_just+flat_map(immediate_just(v*2))+subscribe 5319.54 ns 621.29 ns 608.79 ns 1.02
immediate_just+buffer(2)+subscribe 2492.32 ns 63.45 ns 62.37 ns 1.02
immediate_just+window(2)+subscribe + subscsribe inner 5331.92 ns 2395.09 ns 2332.14 ns 1.03

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 2086.08 ns - - 0.00
immediate_just+take_while(true)+subscribe 2096.82 ns 0.24 ns 0.23 ns 1.04

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 4952.05 ns 5.13 ns 4.78 ns 1.07

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 7362.35 ns 762.97 ns 762.16 ns 1.00
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 8345.97 ns 625.20 ns 623.54 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 582.71 ns 578.29 ns 1.01
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 8037.62 ns 1911.37 ns 1872.72 ns 1.02
immediate_just(1) + zip(immediate_just(2)) + subscribe 5163.89 ns 786.85 ns 766.20 ns 1.03

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 83.74 ns 57.68 ns 46.75 ns 1.23
subscribe 100 observers to publish_subject 350786.33 ns 50009.09 ns 39125.86 ns 1.28
100 on_next to 100 observers to publish_subject 56987.78 ns 19203.72 ns 15919.83 ns 1.21

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 2783.82 ns 67.33 ns 64.42 ns 1.05
basic sample with immediate scheduler 2754.62 ns 18.70 ns 18.30 ns 1.02

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 2380.13 ns 0.23 ns 0.23 ns 1.02

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 6669.30 ns 3964.47 ns 3779.02 ns 1.05
create(on_error())+retry(1)+subscribe 1847.34 ns 362.61 ns 351.79 ns 1.03

ci-ubuntu-clang

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 282.28 ns 1.55 ns 0.89 ns 1.75
Subscribe empty callbacks to empty observable via pipe operator 270.47 ns 1.55 ns 0.88 ns 1.76

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 559.75 ns 0.31 ns 0.31 ns 1.00
from array of 1 - create + subscribe + current_thread 804.44 ns 4.35 ns 4.35 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 2380.66 ns 187.11 ns 181.10 ns 1.03
defer from array of 1 - defer + create + subscribe + immediate 786.29 ns 0.31 ns 0.31 ns 1.00
interval - interval + take(3) + subscribe + immediate 2225.01 ns 58.68 ns 58.69 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3220.85 ns 31.07 ns 31.09 ns 1.00
from array of 1 - create + as_blocking + subscribe + new_thread 31056.97 ns 28972.71 ns 30571.98 ns 0.95
from array of 1000 - create + as_blocking + subscribe + new_thread 40569.38 ns 36575.26 ns 36567.40 ns 1.00
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 3722.88 ns 302.49 ns 308.23 ns 0.98

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1164.08 ns 0.32 ns 0.31 ns 1.03
immediate_just+filter(true)+subscribe 849.53 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1123.87 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 873.20 ns 0.62 ns 0.62 ns 1.00
immediate_just(1,2)+first()+subscribe 1374.70 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2)+last()+subscribe 1011.80 ns 0.31 ns 0.31 ns 1.00
immediate_just+take_last(1)+subscribe 1206.67 ns 0.31 ns 0.31 ns 1.00
immediate_just(1,2,3)+element_at(1)+subscribe 867.84 ns 0.31 ns 0.31 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 280.16 ns 1.55 ns 0.88 ns 1.76
current_thread scheduler create worker + schedule 398.36 ns 4.98 ns 4.97 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 875.13 ns 55.90 ns 56.57 ns 0.99

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 849.60 ns 0.31 ns 0.31 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 984.05 ns 0.32 ns 0.32 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 2235.49 ns 173.95 ns 173.09 ns 1.00
immediate_just+buffer(2)+subscribe 1522.59 ns 13.98 ns 13.98 ns 1.00
immediate_just+window(2)+subscribe + subscsribe inner 2527.49 ns 941.48 ns 929.16 ns 1.01

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 837.75 ns - - 0.00
immediate_just+take_while(true)+subscribe 846.38 ns 0.31 ns 0.31 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 2019.31 ns 0.31 ns 0.31 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 3305.88 ns 202.69 ns 203.54 ns 1.00
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 3717.39 ns 160.35 ns 161.06 ns 1.00
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 199.27 ns 199.94 ns 1.00
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 3395.55 ns 863.40 ns 857.74 ns 1.01
immediate_just(1) + zip(immediate_just(2)) + subscribe 2218.28 ns 159.70 ns 159.61 ns 1.00

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 54.32 ns 17.91 ns 17.69 ns 1.01
subscribe 100 observers to publish_subject 210936.80 ns 16093.51 ns 16542.57 ns 0.97
100 on_next to 100 observers to publish_subject 37916.68 ns 17491.37 ns 20562.62 ns 0.85

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1288.53 ns 11.80 ns 11.81 ns 1.00
basic sample with immediate scheduler 1316.90 ns 6.21 ns 6.21 ns 1.00

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 989.31 ns 0.31 ns 0.31 ns 1.00

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2182.40 ns 1052.51 ns 1026.93 ns 1.02
create(on_error())+retry(1)+subscribe 658.74 ns 157.08 ns 156.88 ns 1.00

ci-windows

General

name rxcpp rpp prev rpp ratio
Subscribe empty callbacks to empty observable 566.85 ns 4.32 ns 4.32 ns 1.00
Subscribe empty callbacks to empty observable via pipe operator 583.31 ns 4.32 ns 4.32 ns 1.00

Sources

name rxcpp rpp prev rpp ratio
from array of 1 - create + subscribe + immediate 1159.36 ns 9.63 ns 9.72 ns 0.99
from array of 1 - create + subscribe + current_thread 1423.04 ns 17.91 ns 17.90 ns 1.00
concat_as_source of just(1 immediate) create + subscribe 3789.04 ns 245.49 ns 243.51 ns 1.01
defer from array of 1 - defer + create + subscribe + immediate 1205.26 ns 9.44 ns 9.44 ns 1.00
interval - interval + take(3) + subscribe + immediate 3403.67 ns 145.25 ns 145.30 ns 1.00
interval - interval + take(3) + subscribe + current_thread 3496.26 ns 65.38 ns 65.94 ns 0.99
from array of 1 - create + as_blocking + subscribe + new_thread 131850.00 ns 125888.89 ns 121522.22 ns 1.04
from array of 1000 - create + as_blocking + subscribe + new_thread 143462.50 ns 142875.00 ns 134775.00 ns 1.06
concat_as_source of just(1 immediate) and just(1,2 immediate)create + subscribe 5437.74 ns 313.10 ns 318.02 ns 0.98

Filtering Operators

name rxcpp rpp prev rpp ratio
immediate_just+take(1)+subscribe 1835.73 ns 25.28 ns 25.28 ns 1.00
immediate_just+filter(true)+subscribe 1338.82 ns 24.35 ns 24.35 ns 1.00
immediate_just(1,2)+skip(1)+subscribe 1969.18 ns 24.06 ns 24.06 ns 1.00
immediate_just(1,1,2)+distinct_until_changed()+subscribe 1379.87 ns 28.99 ns 28.99 ns 1.00
immediate_just(1,2)+first()+subscribe 2073.38 ns 22.83 ns 22.82 ns 1.00
immediate_just(1,2)+last()+subscribe 1804.64 ns 24.06 ns 24.06 ns 1.00
immediate_just+take_last(1)+subscribe 2029.12 ns 74.53 ns 71.79 ns 1.04
immediate_just(1,2,3)+element_at(1)+subscribe 1366.67 ns 27.44 ns 27.46 ns 1.00

Schedulers

name rxcpp rpp prev rpp ratio
immediate scheduler create worker + schedule 483.12 ns 6.48 ns 6.48 ns 1.00
current_thread scheduler create worker + schedule 662.65 ns 13.94 ns 13.94 ns 1.00
current_thread scheduler create worker + schedule + recursive schedule 1356.16 ns 104.75 ns 105.41 ns 0.99

Transforming Operators

name rxcpp rpp prev rpp ratio
immediate_just+map(v*2)+subscribe 1344.09 ns 24.35 ns 24.35 ns 1.00
immediate_just+scan(10, std::plus)+subscribe 1431.97 ns 26.54 ns 26.53 ns 1.00
immediate_just+flat_map(immediate_just(v*2))+subscribe 3502.05 ns 352.06 ns 359.96 ns 0.98
immediate_just+buffer(2)+subscribe 2664.25 ns 72.25 ns 69.15 ns 1.04
immediate_just+window(2)+subscribe + subscsribe inner 4059.09 ns 1294.93 ns 1318.38 ns 0.98

Conditional Operators

name rxcpp rpp prev rpp ratio
immediate_just+take_while(false)+subscribe 1657.95 ns 23.12 ns 23.12 ns 1.00
immediate_just+take_while(true)+subscribe 1333.09 ns 24.35 ns 24.35 ns 1.00

Utility Operators

name rxcpp rpp prev rpp ratio
immediate_just(1)+subscribe_on(immediate)+subscribe 4165.83 ns 11.10 ns 11.11 ns 1.00

Combining Operators

name rxcpp rpp prev rpp ratio
immediate_just(immediate_just(1), immediate_just(1)) + merge() + subscribe 5102.68 ns 418.17 ns 428.42 ns 0.98
immediate_just(1) + merge_with(immediate_just(2)) + subscribe 5488.48 ns 328.27 ns 325.76 ns 1.01
immediate_just(1) + with_latest_from(immediate_just(2)) + subscribe - 306.33 ns 300.95 ns 1.02
immediate_just(immediate_just(1),immediate_just(1)) + switch_on_next() + subscribe 5270.00 ns 940.97 ns 958.99 ns 0.98
immediate_just(1) + zip(immediate_just(2)) + subscribe 3587.00 ns 547.79 ns 567.92 ns 0.96

Subjects

name rxcpp rpp prev rpp ratio
publish_subject with 1 observer - on_next 36.94 ns 19.60 ns 19.51 ns 1.00
subscribe 100 observers to publish_subject 258750.00 ns 27743.90 ns 29637.50 ns 0.94
100 on_next to 100 observers to publish_subject 48554.55 ns 32575.00 ns 32597.14 ns 1.00

Scenarios

name rxcpp rpp prev rpp ratio
basic sample 1906.20 ns 102.52 ns 101.44 ns 1.01
basic sample with immediate scheduler 1907.02 ns 74.39 ns 73.80 ns 1.01

Aggregating Operators

name rxcpp rpp prev rpp ratio
immediate_just+reduce(10, std::plus)+subscribe 1459.78 ns 24.97 ns 24.97 ns 1.00

Error Handling Operators

name rxcpp rpp prev rpp ratio
create(on_next(1), on_error())+on_error_resume_next(immediate_just(2)))+subscribe 2191.03 ns 256.91 ns 259.57 ns 0.99
create(on_error())+retry(1)+subscribe 1171.74 ns 192.33 ns 191.22 ns 1.01

@codecov

codecov Bot commented Oct 7, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.75%. Comparing base (92d1dbe) to head (e75e4e9).
Report is 1 commits behind head on v2.

Additional details and impacted files
@@           Coverage Diff           @@
##               v2     #654   +/-   ##
=======================================
  Coverage   95.75%   95.75%           
=======================================
  Files          97       97           
  Lines        1838     1838           
=======================================
  Hits         1760     1760           
  Misses         78       78           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between aa955b8 and e75e4e9.

📒 Files selected for processing (1)
  • cppcheck.supp (1 hunks)
🧰 Additional context used
🔇 Additional comments (6)
cppcheck.supp (6)

1-1: Suppression rule for missing system includes noted.


3-3: Suppression rule for non-explicit constructors noted.


5-5: Suppression rule for unknown macros noted.


7-7: Suppression rule for function shadowing noted.


9-9: Suppression rule for unused variables noted.


11-11: Suppression rule for local mutexes noted.

Comment thread cppcheck.supp

localMutex

unmatchedSuppression

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider the implications of suppressing unmatched suppression warnings.

The unmatchedSuppression rule suppresses warnings about suppression rules that don't match any warnings. While this can reduce noise in the Cppcheck output, it may hide important information:

  1. It could mask outdated suppression rules that are no longer needed, leading to unnecessary complexity in your suppression file.
  2. It might hide incorrectly specified suppression rules, potentially leaving real issues unsuppressed.

Consider implementing a process to periodically review all suppression rules, especially focusing on those that don't match any warnings. This will help maintain a clean and effective set of suppression rules.

You could add a comment in this file to remind about periodic reviews:

# unmatchedSuppression
# Note: Periodically review all suppression rules, especially those that don't match any warnings.
# Next review date: [specify a date]
unmatchedSuppression

Comment thread cppcheck.supp
Comment on lines +1 to +13
missingIncludeSystem

noExplicitConstructor

unknownMacro

shadowFunction

unusedVariable

localMutex

unmatchedSuppression

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance file structure and documentation for better maintainability.

While the individual suppression rules have been addressed, the overall structure and documentation of this file could be improved:

  1. Add a header comment explaining the purpose of this file and how to use it.
  2. Group related suppressions together.
  3. Add comments for each suppression rule explaining its purpose and potential risks.

Consider restructuring the file as follows:

# Cppcheck Suppression File
# This file contains suppression rules for Cppcheck static analysis tool.
# Each rule should be reviewed periodically to ensure it's still necessary.

# System and compiler-related suppressions
missingIncludeSystem  # Suppresses warnings about missing system includes
unknownMacro  # Suppresses warnings about unknown macros

# Code style and design suppressions
noExplicitConstructor  # Suppresses warnings about non-explicit constructors
shadowFunction  # Suppresses warnings about function shadowing
unusedVariable  # Suppresses warnings about unused variables

# Threading-related suppressions
localMutex  # Suppresses warnings related to local mutexes

# Meta-suppressions
unmatchedSuppression  # Suppresses warnings about unmatched suppressions

# Next review date: [specify a date]

This structure provides context for each suppression and groups related rules together, making the file easier to maintain and understand.

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2024

Copy link
Copy Markdown

@AlexInLog AlexInLog marked this pull request as ready for review October 8, 2024 09:58
@AlexInLog AlexInLog merged commit f301790 into v2 Oct 8, 2024
@AlexInLog AlexInLog deleted the use_cppcheck_right branch October 8, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant